package cn.net.xyan.yypt.dto.protal

import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement

@JacksonXmlRootElement(localName = "xml")
class LKAlipayRsp<B:LKAlipayRspBody>{

    companion object {
        fun <B:LKAlipayRspBody> makeRsp(body:B):LKAlipayRsp<B>{
            val rsp = LKAlipayRsp<B>()
            rsp.body = body
            return rsp
        }
    }
    class Head

    @JacksonXmlProperty(localName = "head")
    var head:Head? = Head()

    @JacksonXmlProperty(localName = "body")
    var body:B? = null
}

abstract class LKAlipayRspBody{
    class LKResponseResult{

        @JacksonXmlProperty(localName = "IsSuccess")
        var isSuccess:Int? = null

        @JacksonXmlProperty(localName = "Message")
        var message:String? = null

        @JacksonXmlProperty(localName = "SubCode")
        var subCode:String? = null

        @JacksonXmlProperty(localName = "SubMessage")
        var subMessage:String? = null
    }

    @JacksonXmlProperty(localName = "ResponseResult")
    val responseResult:LKResponseResult = LKResponseResult()
}


class QrcodeTradePayResultBody:LKAlipayRspBody(){
    class QrcodeTradePayResult{

        @JacksonXmlProperty(localName = "OutTradeNo")
        var outTradeNo:String? = null

        @JacksonXmlProperty(localName = "TwoDimensionCode")
        var twoDimensionCode:String? = null
    }

    @JacksonXmlProperty(localName = "QrcodeTradePayResult")
    val qrcodeTradePayResult:QrcodeTradePayResult = QrcodeTradePayResult()
}

class BarcodeTradePayResultBody:LKAlipayRspBody(){
    class BarcodeTradePayResult{

        @JacksonXmlProperty(localName = "OutTradeNo")
        var outTradeNo:String? = null

        @JacksonXmlProperty(localName = "TradeNo")
        var tradeNo:String? = null

        @JacksonXmlProperty(localName = "Amount")
        var amount:String? = null
    }

    @JacksonXmlProperty(localName = "barcodeTradePayResult")
    val barcodeTradePayResult:BarcodeTradePayResult = BarcodeTradePayResult()
}

class BarcodeTradeCancelResultBody:LKAlipayRspBody(){
    class BarcodeTradeCancelResult{

        @JacksonXmlProperty(localName = "TradeNo")
        var tradeNo:String? = null

        @JacksonXmlProperty(localName = "OutTradeNo")
        var outTradeNo:String? = null

        @JacksonXmlProperty(localName = "RetryFlag")
        var retryFlag:String? = null

        @JacksonXmlProperty(localName = "CancelAction")
        var cancelAction:String? = null
    }

    @JacksonXmlProperty(localName = "BarcodeTradeCancelResult")
    val barcodeTradeCancelResult:BarcodeTradeCancelResult = BarcodeTradeCancelResult()
}

class TradeStatusModelBody:LKAlipayRspBody(){
    class TradeStatusModel{
        @JacksonXmlProperty(localName = "TradeStatus")
        var tradeStatus:String? = null
    }

    @JacksonXmlProperty(localName = "TradeStatusModel")
    val tradeStatusModel:TradeStatusModel = TradeStatusModel()
}

